


import 'package:bike_ride/common/util/hysize_fit.dart';
import 'package:bike_ride/common/widget/dialog/mydialog.dart';
import 'package:bike_ride/generated/l10n.dart';
import 'package:bike_ride/main/app.dart';
import 'package:bike_ride/res/style/color_styles.dart';
import 'package:flutter/material.dart';

const positiveButtonTextStyle = TextStyle(color: ColorStyles.color_primary, fontSize: 16);
const negativeButtonTextStyle = TextStyle(color: Colors.black87, fontSize: 16);

/// 权限弹窗
class PermissionDialog{
  static final BuildContext context = navigatorKey.currentContext!;
  static Future<bool?> show(String title, String message,{String? positiveButton, String? negativeButton}) async{
    positiveButton??= S.current.confirm;
    negativeButton??= S.current.cancel;
    return await showDialog<bool>(
      context: context,
      builder: (context) => AlertDialog(
        title: Text(title),
        content: Text(message),
        actions: <Widget>[
          TextButton(
            child: Text(negativeButton!,style: negativeButtonTextStyle,),
            onPressed: () => Navigator.of(context).pop(false),
          ),
          TextButton(
            onPressed: ()=> Navigator.of(context).pop(true),
            child: Text(positiveButton!,style: positiveButtonTextStyle,),
          ),
        ]
      )
    );
  }
}


void showPaySuccessDialog(){
  final BuildContext context = navigatorKey.currentContext!;

  showAlertDialog(
    context: context,
    confirmName: S.current.known,
    title: '',
    hasCancel:false,
    content: Column(
      mainAxisSize: MainAxisSize.min,
      children: [
        Image.asset('assets/applet/ic_unlock_success.png',
          width: 96.rpx,
          height: 96.rpx,),
        SizedBox(height: 16.rpx,),
        Text(S.current.payFinish,style: TextStyle(fontSize: 28.rpx,color: ColorStyles.color_333333),)
      ],
    ),
    onConfirm: () {
      Navigator.pop(context);
    },
  );
}
